﻿@{
    ViewBag.Title = "LoadConfig";
}
@model IList<WebClientPlatform.Models.DatabaseModel> 
<h2>文件信息</h2> <a href='@Url.Action("LoadFtps")'>返回</a>
@*new { enctype = "multipart/form-data" }比不可少，否则上传文件不会成功 *@
@using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    <text>选择上传文件：</text><input name="file" type="file" id="file" /> <input type="submit" name="Upload" value="Upload" />
}
<br />
@using (Html.BeginForm("LoadConfig", "Home", FormMethod.Post))
{
    <input type="hidden" name="filePath" value="@ViewBag.FilePath" />
    <input type="text" name="querykey" value="@ViewBag.QueryKey" /> <input type="submit" name="btnQuery" value="查询" />
}

<br />

@if (Model != null)
{
    <table>
        <thead>
            <tr>
                <th style="width:100px;">名称</th>
                <th style="width:40px;">默认</th>
                <th>类别</th>
                <th style="width:80px;">是否启用</th>
                <th style="width:800px;">连接串</th>
                <th style="width:40px;">权重</th>
                <th style="width:40px;">加密</th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {
            <tr>
                <td>@item.Name</td>
                <td>@item.IsDefault</td>
                <td colspan="5"></td>
            </tr>
            <tr>
                <td></td>
                <td></td>
                <td>read</td>
                <td colspan="4"></td>
            </tr>
            foreach (var read in item.Reads)
            {
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td>@read.Enabled</td>
                <td>@read.ConnectionString</td>
                <td>@read.Weight</td>
                <td>@read.Encrypt</td>
            </tr>
            }
            <tr>
                <td></td>
                <td></td>
                <td>write</td>
                <td colspan="4"></td>
            </tr>
            foreach (var write in item.Writes)
            {
            <tr>
                <td></td>
                <td></td>
                <td></td>
                <td>@write.Enabled</td>
                <td>@write.ConnectionString</td>
                <td>@write.Weight</td>
                <td>@write.Encrypt</td>
            </tr>
            }
        }
    </table>
}

